module.exports = (sequelize, DataTypes) => {
    const Role = sequelize.define(
        'Role',
        {
            id: {
                type: DataTypes.BIGINT.UNSIGNED,
                allowNull: false,
                autoIncrement: true,
                primaryKey: true
            },
            role: {
                type: DataTypes.STRING(20),
                allowNull: false,
                validate: {
                    notNull: {
                        msg: '权限不能为空'
                    }
                },
                unique: true,
                comment: '代表权限的字符串'
            },
            des: {
                type: DataTypes.STRING(20),
                allowNull: false,
                validate: {
                    notNull: {
                        msg: '权限描述信息不能为空'
                    }
                },
                comment: '权限的描述信息'
            }
        },
        {
            tableName: 'role'
        }
    )

    return Role
}
